function CMain(oDataInfo) {
    var _bUpdate;
    var _iState = STATE_LOADING;
    var _oDataInfo;
    var _oGame;

    this.initContainer = function () {
        var ctxContent = $('#ctxContent').val();

        var canvas = document.getElementById("gameView");
        s_oStage = new createjs.Stage(canvas);
        createjs.Touch.enable(s_oStage);
        s_oStage.preventSelection = false;

        s_bMobile = jQuery.browser.mobile;
        if (s_bMobile === false) {
            s_oStage.enableMouseOver(20);
            $('body').on('contextmenu', '#canvas', function (e) {
                return false;
            });
        }

        createjs.Ticker.addEventListener("tick", this._update);
        createjs.Ticker.setFPS(30);

        if (navigator.userAgent.match(/Windows Phone/i)) {
            DISABLE_SOUND_MOBILE = true;
        }

        s_oSpriteLibrary = new createjs.LoadQueue(false);
        s_oSpriteLibrary.installPlugin(createjs.Sound);

        var loadData = [
            {
                id: "home",
                src: ctxContent + "/front/img/home-a.png"
            }, {
                id: "bg",
                src: ctxContent + "/front/img/bg.png"
            }, {
                id: "audio_icon",
                src: ctxContent + "/front/img/audio_icon.png"
            }, {
                id: "blackboard",
                src: ctxContent + "/front/img/blackboard.png"
            }, {
                id: "reset",
                src: ctxContent + "/front/img/reset.png"
            }, {
                id: "next",
                src: ctxContent + "/front/img/next-a.png"
            }, {
                id: "pre",
                src: ctxContent + "/front/img/pre-a.png"
            }, {
                id: "setting",
                src: ctxContent + "/front/img/setting.png"
            }, {
                id: "shengyin",
                src: ctxContent + "/front/img/shengyin.png"
            }, {
                id: "star",
                src: ctxContent + "/front/img/star.png"
            }, {
                id: "sound",
                src: ctxContent + "/front/img/sound-a.png"
            }, {
                id: "soundsprite",
                src: ctxContent + "/front/img/soundsprite.png"
            }, {
                id: "click",
                src: ctxContent + "/front/mp3/click.mp3"
            }, {
                id: "pre-dis",
                src: ctxContent + "/front/img/pre.png"
            }, {
                id: "nxt-dis",
                src: ctxContent + "/front/img/next.png"
            }
        ];

        var o = new Object();
        o.id  = _oDataInfo.sou;
        o.src = _oDataInfo.src;
        loadData.push(o);

        // 资源列表
        s_oSpriteLibrary.loadManifest(loadData);

        //文件加载进程
        s_oSpriteLibrary.on("progress", function() {
            document.querySelector("#load-msg").innerText = "加载中"+parseInt(s_oSpriteLibrary.progress*100)+"%...";
            //加载完成把进度条隐藏
            if(parseInt(s_oSpriteLibrary.progress*100) === 100){
                document.querySelector("#load-msg").style.display = "none";
            }
        });
        //文件加载完成执行
        s_oSpriteLibrary.addEventListener("complete", function () {
            s_oMain.gotoGame();
        });

        _bUpdate = true;
    };

    this.findDataInfo = function (szKey) {
        for (var i = 0; i < oData.datas.length; i++) {
            if (szKey == oData.datas[i].key) {
                return oData.datas[i];
            }
        }
    };

    this.gotoGame = function (szKey) {
        _oGame = new CGame(oDataInfo);
        _iState = STATE_GAME;
    };

    this._update = function (event) {
        if (_bUpdate === false) {
            return;
        }

        s_oStage.update(event);
    };

    s_oMain = this;
    _oDataInfo = oDataInfo;
    this.initContainer();
}

var s_bMobile;
var s_bAudioActive = true;

var s_oStage;
var s_oMain;
var s_oMenu;
var s_oSpriteLibrary;
